/**
 * Created by chenyong on 2015/7/16.
 */

var express = require('express'),
    config = require('./../config'),
    user = require('./user.service'),
    auth = require('./auth.service');

require('./wechat/passport').setup(config);
require('./weibo/passport').setup(config);
require('./qq/passport').setup(config);

var router = express.Router();
router.use('/wechat', require('./wechat'));
router.use('/weibo', require('./weibo'));
router.use('/qq', require('./qq'));
router.use('/facebook', require('./facebook'));
router.use('/twitter', require('./twitter'));

router.get('/failure', function (req, res) {
    res.send({message: 'login error'});
});
router.get('/success', function (req, res) {
    res.render('account/login-success',{title:'登录成功'});
});

router.get('/me',auth.isAuthenticated(),user.currentuserinfo)

module.exports = router;
